Test Series - Data Structure

Test Number 109/115

Q: The number of elements in the adjacency matrix of a graph having 7 vertices is __________
A. 7
B. 14
C. 36
D. 49
Solution: There are n*n elements in the adjacency matrix of a graph with n vertices.
Q: Adjacency matrix of all graphs are symmetric.
A. False
B. True
C. 
D. 
Solution: Only undirected graphs produce symmetric adjacency matrices.
Q: The time complexity to calculate the number of edges in a graph whose information in stored in form of an adjacency matrix is ____________
A. O(V)
B. O(E2)
C. O(E)
D. O(V2)
Solution: As V entries are 0, a total of V2-V entries are to be examined.
Q: For the adjacency matrix of a directed graph the row sum is the _________ degree and the column sum is the ________ degree.
A. in, out
B. out, in
C. in, total
D. total, out
Solution: Row number of the matrix represents the tail, while Column number represents the head of the edge.
Q: What is the maximum number of possible non zero values in an adjacency matrix of a simple graph with n vertices?
A. (n*(n-1))/2
B. (n*(n+1))/2
C. n*(n-1)
D. n*(n+1)
Solution: Out of n*n possible values for a simple graph the diagonal values will always be zero.
Q: On which of the following statements does the time complexity of checking if an edge exists between two particular vertices is not, depends?
A. Depends on the number of edges
B. Depends on the number of vertices
C. Is independent of both the number of edges and vertices
D. It depends on both the number of edges and vertices
Solution: To check if there is an edge between to vertices i and j, it is enough to see if the value of A[i][j] is 1 or 0, here A is the adjacency matrix.
Q: In the given connected graph G, what is the value of rad(G) and diam(G)?
A. 2, 3
B. 3, 2
C. 2, 2
D. 3, 3
Solution: Value of eccentricity for vertices A, C is 2 whereas for F, B, D, E it is 3.
Q: Which of these adjacency matrices represents a simple graph?
A. [ [1, 0, 0], [0, 1, 0], [0, 1, 1] ]
B. [ [1, 1, 1], [1, 1, 1], [1, 1, 1] ]
C. [ [0, 0, 1], [0, 0, 0], [0, 0, 1] ]
D. [ [0, 0, 1], [1, 0, 1], [1, 0, 0] ]
Solution: A simple graph must have no-self loops, should be undirected.
Q: Given an adjacency matrix A = [ [0, 1, 1], [1, 0, 1], [1, 1, 0] ], The total no. of ways in which every vertex can walk to itself using 2 edges is ________
A. 2
B. 4
C. 6
D. 8
Solution: A2 = [ [2, 1, 1], [1, 2, 1], [1, 1, 2] ], all the 3 vertices can reach to themselves in 2 ways, hence a total of 3*2, 6 ways.
Q: If A[x+3][y+5] represents an adjacency matrix, which of these could be the value of x and y.
A. x=5, y=3
B. x=3, y=5
C. x=3, y=3
D. x=5, y=5
Solution: All adjacency matrices are square matrices.

You Have Score    /10